<?php
include "connect.php";
session_start();
$user=$_SESSION['user'];
$selectuser="SELECT * from b_users a, b_templates b where b.templateid=a.templateclass and a.username='$user'";
$selectuser2=mysql_query($selectuser);
$selectuser3=mysql_fetch_array($selectuser2);
print "<link rel='stylesheet' href='style.css' type='text/css'>";

if ($selectuser3[status]>="3")
   {
      print "<br><br><br><br><table border='0'>";
      print "<tr><td valign='top'><center>";
      print "<table width='70%' border='0' class='maintable'>";
      print "<tr class='headline'><td width='300px'>Admin Options";
      print "</td></tr>";
      print "<tr class='forumrow'><td>";
      include "adminleft.php";
      print "</td></tr></table></center></td>";
      print "<td valign='top' width='75%'><p align='left'>";
      print "<table width='90%' border='0' class='maintable'>";
      print "<tr class='headline'><td>Delete Template";
      print "</td></tr>";
      print "<tr class='forumrow'><td>";
      if(isset($_POST['submit']))
      {
         $deltemplate=$_POST['deltemplate'];        
         $deletetemplate="Delete from b_templates where templateid='$deltemplate'";
         mysql_query($deletetemplate) or die("Could not delete template");
         print "Template Deleted.";

      }
      else 
      {
         $gettemplates="SELECT * from b_templates where templateid!='1' order by templateid desc";
         $gettemplates2=mysql_query($gettemplates) or die("Could not get templates");
         print "<form action='deletetemplate.php' method='post'>";
         print "After delete the template here, you must manually delete subfolder that holds the template files in ftp or another file manager to completely remove the template<br><br>";
         print "Template to Delete:<br>";
         print "<select name='deltemplate'>";
         while($gettemplates3=mysql_fetch_array($gettemplates2))
         {
            print "<option value='$gettemplates3[templateid]'>$gettemplates3[templatepath]</option>";
         }
         print "</select><br>";
         print "<input type='submit' name='submit' value='submit'></form>";
  

  

      }
  
      print "</td></tr></table>";
   }
   
else
   {
     print "<table width='70%' border='0'>";
     print "<tr class='headline'><td><center>Not logged in as Admin</td></tr>";
     print "<tr class='forumrow'><td>";
     print "You are not logged in as Administrator, please log in.";
     print "<form method='POST' action='../authenticate.php'>";
     print "Type Username Here: <input type='text' name='username' size='15'><br>";
     print "Type Password Here: <input type='password' name='password' size='15'><br>";
     print "<input type='submit' value='submit' name='submit'>";
     print "</form>";
     print "</td></tr></table>";
   }

?>

